home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / AEhyperLayoutTemplate.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  4.4 KB  |  150 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //    Alias|Wavefront Script File
  19. //
  20. //    Creation Date:    June 16, 1997
  21. //    Author:            sw
  22. //
  23. //    Procedure Name:
  24. //    AEhyperLayoutTemplate
  25. //
  26. //    Description Name;
  27. //    Creates the attribute editor controls for the hyperLayout node
  28. //
  29. //    Input Value:
  30. //    nodeName
  31. //
  32. //    Output Value:
  33. //    None
  34. //
  35.  
  36.  
  37. //
  38. //  Procedure Name:
  39. //    AEhyperLayoutImageNameNew 
  40. //
  41.  
  42. global proc AEhyperLayoutImageNameNew (string $fileAttribute)
  43. {
  44.     setUITemplate -pst attributeEditorTemplate;
  45.     rowLayout -nc 3 hyperLayoutImageNameLayout;
  46.         text -l "Image Name";
  47.         textField hyperLayoutImageNameField;
  48.             symbolButton -image "navButtonBrowse.xpm" browser;
  49.     setParent ..;
  50.     setUITemplate -ppt;
  51.     
  52.     AEhyperLayoutImageNameReplace $fileAttribute;
  53. }
  54.  
  55. //
  56. //  Procedure Name:
  57. //    AEhyperLayoutImageNameReplace
  58. //
  59.  
  60. global proc AEhyperLayoutImageNameReplace (string $fileAttribute)
  61. {
  62.     string $nodeName[];
  63.     tokenize($fileAttribute, ".", $nodeName);
  64.     string $hyperPanel[] = `getPanel -scriptType hyperGraphPanel`;
  65.     string $editor = ($hyperPanel[0] + "HyperGraphEd");
  66.  
  67.     scriptJob -p hyperLayoutImageNameField -rp
  68.         -ac $fileAttribute 
  69.         ("AEhyperLayoutUpdateImageName "+$fileAttribute);
  70.     scriptJob -p hyperLayoutImageNameField 
  71.         -ac ($nodeName[0] + ".imageScale") 
  72.         ("hyperGraph -e -forceRefresh " +$editor);
  73.  
  74.         string $command = "loadHyperGraphImage "+" "+$fileAttribute;
  75.  
  76.         button -e -c $command  browser;
  77.  
  78.         string $command = "loadHyperGraphImageCB "+" "+$fileAttribute;
  79.  
  80.     textField -e -cc "loadHyperGraphImageCB \"#1\"" hyperLayoutImageNameField;
  81. }
  82.  
  83. global proc AEhyperLayoutUpdateImageName (string $fileAttribute)
  84. {
  85.     string $value = `getAttr $fileAttribute`;
  86.     textField -e -tx $value hyperLayoutImageNameField;
  87. }
  88.  
  89. global proc int loadHyperGraphImageCallback ( string $theFile, string $theFileType )
  90. {
  91.     string $hyperPanel[] = `getPanel -scriptType hyperGraphPanel`;
  92.     string $editor = ($hyperPanel[0] + "HyperGraphEd");
  93.  
  94.     // Optional retaining of the new directory.
  95.     string $currentDir = `workspace -q -dir`;
  96. //    retainWorkingDirectory $currentDir;
  97.     
  98.     // Do stuff with $theFile
  99. //    file -i -type $theFileType $theFile;    // Or whatever.
  100.     hyperGraph -e -image $theFile $editor;
  101.     hyperGraph -e -imageEnabled true $editor;
  102.     return 1;
  103. }
  104.  
  105. global proc int loadHyperGraphImageCB ( string $theFile )
  106. {
  107.     string $hyperPanel[] = `getPanel -scriptType hyperGraphPanel`;
  108.     string $editor = ($hyperPanel[0] + "HyperGraphEd");
  109.  
  110.  
  111.     // Optional retaining of the new directory.
  112.     string $currentDir = `workspace -q -dir`;
  113.     hyperGraph -e -image $theFile $editor;
  114.     hyperGraph -e -imageEnabled true $editor;
  115.     return 1;
  116. }
  117.  
  118. global proc loadHyperGraphImage(string $fileAttribute)
  119. {
  120.     string $hyperPanel[] = `getPanel -scriptType hyperGraphPanel`;
  121.     string $editor = ($hyperPanel[0] + "HyperGraphEd");
  122.  
  123.     $myWorkspace = `workspace -q -fn`;
  124.     setWorkingDirectory($myWorkspace, "image", "images");
  125.     fileBrowser loadHyperGraphImageCallback "Load Image" "image" 0;
  126. }
  127.  
  128.  
  129. global proc AEhyperLayoutTemplate ( string $nodeName )
  130. {
  131.     editorTemplate -beginScrollLayout;
  132.     
  133.         editorTemplate -beginLayout "Hyper Layout Attributes" -collapse 0;
  134.             editorTemplate -callCustom "AEhyperLayoutImageNameNew"
  135.                     "AEhyperLayoutImageNameReplace"
  136.                     "imageName";
  137.             editorTemplate -addControl "imageScale";
  138.         editorTemplate -endLayout;        
  139.  
  140.         // suppressed attributes
  141.         editorTemplate -suppress "imageName";
  142.  
  143.  
  144.         // include/call base class/node attributes
  145.         AEdependNodeTemplate $nodeName;
  146.  
  147.     editorTemplate -addExtraControls;
  148.     editorTemplate -endScrollLayout;
  149. }
  150.